package net.qiqbframework.messaging;


import net.qiqbframework.common.Registration;

import javax.annotation.Nonnull;
import java.util.List;
import java.util.function.Consumer;

/**
 * 订阅消息源
 */
public interface SubscribableMessageSource<M extends Message<?>> {

    /**
     * 订阅 messageProcessor 给定的此消息源。订阅后，它将接收发布到此源的所有消息
     */
    Registration subscribe(@Nonnull Consumer<M> messageProcessor);
}
